-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cohort filtering in ParticipantsDeclarationsQuery #4794
Conversation
Review app deployed to https://cpd-ecf-review-4794-web.test.teacherservices.cloud |
return ParticipantDeclaration.none if npq_lead_provider.blank? | ||
|
||
with_joins(scope).where(participant_profile: { type: "ParticipantProfile::NPQ", schedule: { cohorts: { start_year: cohort_years } } }) | ||
scope = with_joins(ParticipantDeclaration.for_lead_provider(cpd_lead_provider)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im wondering if we need the with_joins
if there is no cohort filter? also worth revisiting those joins as we might no longer need some of them since cohort is on declaration now
c6807d0
to
fa7cec3
Compare
fa7cec3
to
397ed9d
Compare
34f6aec
to
30e3704
Compare
30e3704
to
ab6ad4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
7d6950b
to
9331367
Compare
63e1bb6
to
1366044
Compare
Previously, we would filter using the induction records -> cohort for ECF and profile -> schedule -> cohort for NPQ participants. Now that we have a `cohort` directly on the `ParticipantDeclaration`, we can simplify the filtering logic.
As we filter by declaration -> cohort we no longer need to join on other cohorts. Move join on induction records to previous declarations scope as its only used there.
I wanted to do this in the factory originally, but it creates a cyclic dependency on the `participant_profile -> cohort` so we need to define it explicitly for now.
1366044
to
c57640f
Compare
Context
Jira-3059
Previously, we would filter using the
induction records -> cohort
for ECF andprofile -> schedule -> cohort
for NPQ participants. Now that we have acohort
directly on theParticipantDeclaration
, we can simplify the filtering logic.Changes proposed in this pull request
Guidance to review
I compared filtering against the snapshot DB using
main
and this branch and added a diff of where the API endpoint would return differently for a few providers/cohorts. The vast majority that differ are eithervoided
,clawedback
orawaiting_clawback
and for the most part the stampedcohort
matches thefirst statement -> cohort
but theparticipant profile -> schedule -> cohort
orlatest induction record -> cohort
causes it to return differently in the current declarations API.